<?php
	include "../db.php";
	include "../scripts/scripts.php";
?>
<head>
<script>
function add_student_industry_problem_ajax(id)
	{
	//document.getElementById(id).value = "Nisarg Mehta";
	var xmlhttp;
	var guide_id = document.getElementById(id).value;
	if(guide_id.length==0) return;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()	
	{
		if(xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			
		}
		//document.getElementById('lbl1').innerHTML = xmlhttp.responseText;
		//document.getElementById(id).value=xmlhttp.responseText;
	}
	xmlhttp.open("GET","add_student_industry_problem_ajax.php",true);
	xmlhttp.send();
	}
	var src;
	var src1 = new Array();
	xmlhttp=new XMLHttpRequest();
	xmlhttp.onreadystatechange=function()	
	{
		if(xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			try {
			src = xmlhttp.responseText;
			src1 = src.split(",");
			document.getElementById('guide123').value = src;
			$( "#guide123" ).autocomplete({
				source: ["a","b","c"]//src1
			});
			}
			catch(err) {
				alert("all_team_of_student_ajax : Error : "+err);
			}
		}
	}
	xmlhttp.open("GET","../project/list_of_all_guides.php",true);
	xmlhttp.send();
	
</script>
</head>
<?php
	include "../db.php";
	session_start();
	if(trim($_SESSION['username'])=="") {
			echo "No Teams Available";
	}
	else {
		$username = $_SESSION['username'];
		$q = "select * from team where leader_id = '$username'";
		$rs = mysql_query($q);
		if(!$rs) echo mysql_error();
		$result = "Select Team123<br />";
		if(($row=mysql_fetch_assoc($rs))!=NULL)
		{
			//$result = $result.$row['name']."<br />";
			$result = $result."<input type='radio' id='one' name='one' value='".$row['name']."' />".$row['name']."123<br />";
		}
		while(($row=mysql_fetch_assoc($rs))!=NULL)
		{
			//$result = $result.$row['name']."<br />";
			if(trim($row['name'])!="")	$result = $result."<input type='radio' id='one' name='one' value='".$row['name']."' />".$row['name']."<br />";
		}
		$result = $result."<input type='text' id='guide123' placeholder='Add Guide' />";
		$result = $result."<input type='button' value='Add Problem' onclick='return add_student_industry_problem_ajax(guide123)' /><label id='err_guide'></label>";
		//$result = $result."<input type='button' onclick='return 
		echo $result;
	}
?>